/**
 * 
 */
package bma.common.thrift.ai;

import org.apache.thrift.TBase;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;

import bma.common.langutil.ai.stack.AIStack;

public abstract class TAIProcessFunction<IFACE, PTYPE extends TBase> {
	private final String methodName;

	public TAIProcessFunction(String methodName) {
		this.methodName = methodName;
	}

	protected boolean getResult(TProtocol in, TProtocol out,
			AIStack<TBase> stack, IFACE iface, PTYPE args) throws TException {
		return getResult(stack, iface, args);
	}

	protected abstract boolean getResult(AIStack<TBase> stack, IFACE iface,
			PTYPE args) throws TException;

	protected abstract PTYPE getEmptyArgsInstance();

	public PTYPE queryEmptyArgsInstance() {
		return getEmptyArgsInstance();
	}

	public String getMethodName() {
		return methodName;
	}
}